a5a24db34233df15a8e128a9636cec4eaabcdbad,src/edu/stanford/nlp/util/concurrent/ConcurrentHashIndex.java,ConcurrentHashIndex,indexOf,#E#boolean#,68

Before Change


      // TODO(spenceg) The Index interface contract states that indices must be
      // non-negative and continuous. We tried to satisfy this requirement without
      // a lock (e.g., by using AtomicInteger) but couldn't make it work.
      synchronized(this) {
        if ( ! item2Index.containsKey(o)) {
          int newIndex = index2Item.size();
          item2Index.put(o, newIndex);
          index2Item.put(newIndex, o);
        }
      }

After Change


    if (atomic == null) {
      if (add) {
        final int newIndex = indexCounter.getAndIncrement();
        atomic = item2Index.putIfAbsent(o, newIndex);
        if (atomic == null) {
          index2Item.put(newIndex, o);
          return newIndex;
        } else {